﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace ToolRental.Client.Admin
{
    public delegate void CustomCommandDelegate();

    public class CustomCommand : ICommand
    {
        public static bool IsEnabled;

        private CustomCommandDelegate MyDelegate { get; set; }

        public bool CanExecute(object parameter)
        {
            return IsEnabled;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            if (MyDelegate != null)
                MyDelegate();
        }

        public CustomCommand(CustomCommandDelegate del)
        {
            MyDelegate = del;
        }
    }
}
